#coding:utf8
from pyspark import SparkContext,SparkConf

if __name__ == '__main__':
    conf = SparkConf().setAppName("test").setMaster("local[*]")
    sc = SparkContext(conf=conf)

    rdd = sc.textFile('../data/input/words.txt').flatMap(lambda x:x.split(" ")).map(lambda x: (x, 1))
    print(rdd.countByKey())